package cn.tedu.order.controller;

import cn.tedu.order.entity.Order;
import cn.tedu.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName OrderController
 * @Description:类描述
 * @Author Tedu
 * @Date 2021/7/1 11:52
 * @Version V1.0
 **/
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    @GetMapping("/create")  //http://localhost:8083/create?userId=1&productId=1&count=10&money=100
    public String create(Order order){
        orderService.create(order);
        return "创建订单成功";
    }
    @GetMapping("/findById")  //http://localhost:8083/findById?id=2018
    public Order findById(Long id){
        return orderService.findById(id);
    }
}
